#include<stdio.h>
#include<string.h>
#include<assert.h>
void reverse(char* p, char* q)
{
	while (p < q)
	{
		char tmp = *p;
		*p = *q;
		*q = tmp;
		p++;
		q--;
	}
}


void swap(char* str)
{
	assert(str);
	while (*str != '\0')
	{
		char* base = str;
		while (*str != '\0' && *str != ' ')
		{
			str++;
		}
		char* end = str - 1;
		reverse(base, end);
		if (*str == ' ')
		{
			str++;
		}
	}
}

int main()
{
	char arr[20] = { 0 };
	gets(arr);
	size_t right = strlen(arr) - 1;
	reverse(arr,arr+right);
	swap(arr);
	printf("%s\n", arr);
	return 0;
}